import request from '@/utils/request'
/**
 *
 * 员工管理
 *
 **/
// 登录
export const login = (data: any) =>
  request({
    'url': '/employee/login',
    'method': 'post',
    data: data
  })

// 退出
export const userLogout = (params: any) =>
  request({
    'url': `/employee/logout`,
    'method': 'post',
    params
  })
// 查询员工列表接口
export const getEmployeePage = (params: any) => {
  return request({
    url: '/employee/page',
    method: 'get',
    params
  });
};
// 启用或禁用员工
export const enableOrDisableEmployee = (params: any) => {
  return request({
    url: `/employee/status/${params.status}`,
    method: 'post',
    params: { id: params.id }
  })
}
//添加员工
export const addEmployee = (params: any) => {

  console.log(params)
  return request({
    url: '/employee',
    method: 'post',
    data: {...params}
  })
}
export const updateEmployee = (params: any) => {

  console.log(params)
  return request({
    url: '/employee',
    method: 'put',
    data: {...params}
  })
}
// 根据id查询员工
export const getEmployeeById = (id: string | (string | null)[]) => {
  return request({
    url: `/employee/${id}`,
    method: 'get'
  });
};